import java.util.Scanner;

//fibonacci series

//										The input array is 5 
//										Array should have 3 or more elements to check for fibonacci
//									********************************************************************	
//										The input array is 1 1 2 
//										This is a fibonacci series
//									********************************************************************	
//										The input array is 1 91 2 
//										This is not a fibonacci series
//									********************************************************************	
//										The input array is 3 2 7 5 12 34 
//										This is not a fibonacci series
//									********************************************************************	
//										The input array is 3 2 5 7 12 19 
//										This is not a fibonacci series
//                                  ********************************************************************

public class Assignment5 {
	public static void main(String args[]) {
		CalcAPI myapi = new CalcAPI();		
		System.out.println("Enter the number of inputs");
		Scanner s = new Scanner(System.in);
		int numOfInputs = s.nextInt();
		int[] myArray = new int[numOfInputs];
		for(int i=0;i<numOfInputs;i++) {
			System.out.println("Enter integer input #" + (i+1));
			myArray[i] = myapi.getIntInput();				
		}
		System.out.format("%nThe input array is ");
		for(int i=0;i<numOfInputs;i++) {
			System.out.print(myArray[i] + " ");			
		}
		System.out.println();
		boolean isfibonacci = false;
		if(numOfInputs >= 3) {
			for(int i=2;i<numOfInputs;i++) {
				if((myArray[i-1] + myArray[i-2]) == myArray[i])
					isfibonacci = true;
				else
					break;				
			}
			if(isfibonacci)
				System.out.println("This is a fibonacci series");
			else
				System.out.println("This is not a fibonacci series");
		}
		else
			System.out.println("Array should have 3 or more elements to check for fibonacci");
		
	}
}
